.so ../bk-macros
.TH "bk edit" "\*[BKVER]" %E% "\*(BC" "\*(UM"
.SH NAME
bk edit \- check out a file for editing
.SH SYNOPSIS
.B bk edit
.[B] \-q
.[OPTreq] \-r rev
.BKARGS
.SH DESCRIPTION
If a file is not locked for writing, i.e., it is not visible in a
directory listing or it is read-only, then
use
.B bk edit
to check out the file and lock it, making it available for writing.
.LP
.B bk edit
with no options will check out all files in a directory.
.SH OPTIONS
.TP \-r\*<rev\*>
.B \-q
run quietly
.tp
.OPTreq \-r rev
Edit the file, rolling it back to the contents specified by
.ARG rev .
(Or key or changeset revision. See 
.B bk help terms
under \*(lqrev argument\*(rq)
\*(BK will check out the tip revision
combined with a set of include and exclude deltas needed to produce
the requested revision.
.SH NOTES
While it may seem like this step could be done with a simple
.DS
$ chmod +w foo.c
.DE
that is not correct.
The reason is keyword expansion.  
Keywords are expanded only in read-only files, they are unexpanded
in locked files.
For example, if a file contains \f(CB%M% %I%\fP, when it is not locked
that will look like \f(CBfoo.c 1.2\fP.
If the file is modified after the
.B chmod
then the keywords will forever
more be \f(CBfoo.c 1.2\fP, which is not likely to be the desired result.
One could argue that \*(BK should try and catch this case (and it does,
.B bk check
will frequently fix it), but it is impossible to do so correctly in all cases.
.SH SEE ALSO
.SA terms
.SH CATEGORY
.B File
.br
.B Common
